package demon2;

public class Animal {
    protected String name;
    public Animal(String name){
        this.name=name;
    }
    public static void walk(IRunning running){
        running.running();
    }
    public static void fly1(IFlying flying){
        flying.fly();
    }

    public static void main(String[] args) {
        Duck duck=new Duck("鸭子");
        duck.running();
        duck.fly();
        duck.swimming();
    }
}
class Cat extends Animal implements IRunning{
    public Cat(String name){
        super(name);
    }

    @Override
    public void running() {
        System.out.println(this.name+"正在用四条腿跑");
    }
}
class Fish extends Animal implements ISwimming{
    @Override
    public void swimming() {
        System.out.println(this.name+"正在用尾巴游泳");
    }
    public Fish(String name){
        super(name);
    }
}
class Frog extends Animal implements ISwimming,IRunning{
    @Override
    public void running() {
        System.out.println(this.name+"正在游泳");
    }

    @Override
    public void swimming() {
        System.out.println(this.name+"正在跑");
    }
    public Frog(String neme){
        super(neme);
    }
}
class Duck extends Animal implements IRunning,IFlying,ISwimming{
    @Override
    public void fly() {
        System.out.println(this.name+"正在飞");
    }

    @Override
    public void running() {
        System.out.println(this.name+"正在跑");
    }

    @Override
    public void swimming() {
        System.out.println(this.name+"正在游泳");
    }

    public Duck(String name) {
        super(name);
    }
}

